package top.humbleyuan.handtotear;

import java.util.HashMap;

/**
 * @Author HumbleYuan
 * @Date 2020/5/14 13:09
 * @Des
 */
public class Demo1 {
    public static void main(String[] args) {
        //m1();

        // 两个数组取target最近的
        int[] nums1 = {};
        int[] nums2 = {};
        int target = 26;

    }

    /**
     * leet1044
     */
    private static void m1() {
        String s = "abcdabcd";
        HashMap<String, Integer> map = new HashMap<>();
        int maxLen = 0;

        for (int i = 0; i < s.length(); i++) {
            for (int j = 1; j < s.length() && ((j + i) <= s.length()); j++) {
                String cur = s.substring(i, j + i);
                int count = map.getOrDefault(cur, 0);

                if(count >= 1 && cur.length() > maxLen) {
                    maxLen = cur.length();
                }
                map.put(cur, count + 1);
            }
        }
        System.out.println(maxLen);
    }


}
